import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/sys/system/sysUser/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/sys/system/sysUser/info',
    method: 'get',
    params: { token }
  })
}


export function getUserInfo(token) {
  return request({
    url: '/sys/system/sysUser/userInfo',
    method: 'get',
    params: { token }
  })
}


export function updateUserInfo(data) {
  return request({
    url: '/sys/system/sysUser/updateUserInfo',
    method: 'post',
    data
  })
}

export function addUser(data) {
  return request({
    url: '/sys/system/sysUser/addUser',
    method: 'post',
    data:data
  })
}

export function editPassword(token,password) {
  return request({
    url: '/sys/system/sysUser/editPassword',
    method: 'post',
    params: { token,password }
  })
}

export function uploadImg(formData) {
  return request({
    url: '/sys/system/sysUser/uploadImg',
    method: 'post',
    data:formData, 
    headers: {  
      'Content-Type': 'multipart/form-data'  // 这里设置请求头为multipart/form-data，这是用于文件上传的标准格式。  
    }  
  })
}

export function ban(data) {
  return request({
    url: '/sys/system/sysUser/ban',
    method: 'post',
    data
  })
}

export function getList() {
  return request({
    url: '/sys/system/sysUser/list',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/sys/system/sysUser/logout',
    method: 'get'
  })
}
